package net.pws.oos.web.dto;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

@SuppressWarnings("unchecked")
public class IndicatorTemplateTreeNodeDto extends AbstractTreeNode {

	public static IndicatorTemplateTreeNodeDto from(Map<String, String> data, HttpServletRequest request) {
		IndicatorTemplateTreeNodeDto result = new IndicatorTemplateTreeNodeDto();
		try {
            result.metadata = data;
        }
        catch (Exception e) {
        }
//        return result;
//		result.metadata.put("id", indicator.getId());
//		result.metadata.put("name", indicator.getName());
//		result.metadata.put("detailId", indicator.getCode());
//		result.metadata.put("type", "organ");
//		result.metadata = data;
		result.setTitle(data.get("shortName"));
		result.data.put("icon", request.getContextPath() + "/images/organ.png");
		if (data.get("depth") == "3") {
			result.state = "leaf";
		}
		return result;
	}

	public IndicatorTemplateTreeNodeDto() {
	}
}
